<?php

class WContent extends CWidget{
    public $event = false;
    public $education = false;
    public $menu=false;
    public $people=false;

    public function init() {

        parent::init();


        //register js

//        $cs = Yii::app()->clientScript;
//
//        $cs->registerCoreScript('jquery');

        //$cs->registerScriptFile(Yii::app()->assetManager->publish(Yii::getPathOfAlias('application.widgets.newsletter.assets'). DIRECTORY_SEPARATOR. 'newsletter.js'), CClientScript::POS_END);

    }



    public function run() {
        $events='';
        if($this->event){
            $events = db()->createCommand()
                ->from('{{node}}')
                ->where('node_type="event" AND node_status=2')
                ->order('node_id DESC')
                ->limit(6)
                ->queryAll();
        }
        $education='';
        if($this->education){
            $education = db()->createCommand()
                ->from('{{node}}')
                ->where('node_type="education" AND node_status=2')
                ->order('node_id DESC')
                ->limit(6)
                ->queryAll();
        }
        $this->render('index', compact('events','education'));

    }

}